package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppSalesProcessMapper;
import com.ep.modules.app.entity.AppSalesProcess;
import com.ep.modules.app.entity.AppSalesProcessExample;
import com.ep.modules.app.service.AppSalesProcessService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppSalesProcessServiceImpl implements AppSalesProcessService {
    @Autowired
    private AppSalesProcessMapper appSalesProcessMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppSalesProcessExample example = new AppSalesProcessExample();
        AppSalesProcessExample.Criteria criteria = example.createCriteria();
        List<AppSalesProcess> list = appSalesProcessMapper.selectByExample(example);
        Page<AppSalesProcess> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppSalesProcess getById(Long id) {
        return appSalesProcessMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppSalesProcess entity) {
        appSalesProcessMapper.insert(entity);
    }

    public void update(AppSalesProcess entity) {
        appSalesProcessMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appSalesProcessMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}